<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 流年 <liu21st@gmail.com>
// +----------------------------------------------------------------------

// mqnote模块公共文件

/** 
 * 递归重组节点信息多维数组 
 * @param  [array] $node [要处理的节点数组:二维数组] 
 * @param  [int]   $root [根节点id] 
 * @return [array]       [树状结构的节点体系:多维数组] 
 */
function node_merge($node, $root = 0)
{
    $arr = array();
    foreach ($node as $v) {
        if ($v['parent_id'] == $root) {
            $v['child'] = node_merge($node, $v['cate_id']);
            $arr[] = $v;
        }
    }
    return $arr;
} 